package com.star.spring.sharding.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@TableName("t_account")
public class Account {
    @TableId(type = IdType.ASSIGN_ID)
    private Long accountId;
    private Long userId;
    private BigDecimal balance;
    private LocalDateTime createTime;

    // 构造函数
    public Account() {}

    public Account(Long userId, BigDecimal balance) {
        this.userId = userId;
        this.balance = balance;
        this.createTime = LocalDateTime.now();
    }

    // Getter和Setter方法
    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Account{" +
                "accountId=" + accountId +
                ", userId=" + userId +
                ", balance=" + balance +
                ", createTime=" + createTime +
                '}';
    }
}